﻿using M_Quality.API.Application.Command.RawMaterialQualityCommand;
using M_Quality.Domain;
using M_Quality.Repository.Interface;
using MediatR;

namespace M_Quality.API.Application.CommandHandler.RawMaterialQualityCommandHandler
{
    public class ShowRMQCommandHandler : IRequestHandler<ShowRMQCommand, RawMaterialQuality>
    {
        private readonly IRawMaterialQualityRepository repository;

        public ShowRMQCommandHandler(IRawMaterialQualityRepository repository)
        {
            this.repository = repository;
        }

        public async Task<RawMaterialQuality> Handle(ShowRMQCommand request, CancellationToken cancellationToken)
        {
            return await repository.GetModelAsync(request.RawMaterialQualityId);
        }
    }
}
